package com.cz.data;

import cn.hutool.db.Db;
import cn.hutool.db.Entity;

import java.sql.SQLException;
import java.util.List;

public class GetEpkData {
    public static void main(String[] args) throws SQLException {

        String sql = "SELECT \n" +
                "    name \n" +
                "FROM \n" +
                "    ekp.sys.tables\n" +
                "WHERE \n" +
                "    type = 'U'\n" +
                "ORDER BY\n" +
                "    name;";
        List<Entity> entities = Db.use("ekp").query(sql);
        for (Entity entity : entities) {
            String tableName = entity.getStr("name");
            long count = Db.use("ekp").queryNumber("SELECT count(*) FROM " + tableName).longValue();

            if (count > 10000) {
                System.out.println(tableName + " has " + count + " records");
            }
        }
    }
}
